package com.ellricky.newtv.adapter

import android.widget.ImageView
import com.bumptech.glide.Glide
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.ellricky.newtv.R
import com.ellricky.newtv.bean.TvCourseType

class CourseTypeAdapter :
    BaseQuickAdapter<TvCourseType, BaseViewHolder>(R.layout.item_course_type) {
    override fun convert(holder: BaseViewHolder, item: TvCourseType) {
        val ivCourseBg = holder.getView<ImageView>(R.id.ivCourseBg)
        Glide.with(context).load(item.course_background).into(ivCourseBg)
        if (item.endState == 1) {
            holder.setText(R.id.tv_end_time, "到期时间:${item.endDate}")
        } else {
            holder.setText(R.id.tv_end_time, item.endDate)
        }
    }
}